package t3;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/4/9 16:10
 */
public class T1 {
    public static void main(String[] args) throws FileNotFoundException {
        System.out.println("请输入一串内容");
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();

        byte[] bytes=s.getBytes();
        try{
            FileOutputStream fos=new FileOutputStream("example.txt");
            fos.write(bytes);
        } catch (Exception e) {
            e.printStackTrace();
        }

        try{
            FileInputStream fos=new FileInputStream("example.txt");
           while (fos.read()!=-1){
               System.out.println(fos.read());
           }
        }catch (Exception e){
            e.printStackTrace();
        }
        System.out.println();




    }
}
